package com.abc.pro.util;

import android.util.Log;

public class Logger {
    public static boolean DEBUG = true;
    private static String APP_TAG = "Logger";
    public static void e(String message){
        if(DEBUG){
            Log.e(APP_TAG, message);
        }
    }
    
    public static void e(String tag, String message){
        if(DEBUG){
            Log.e(tag, message);
        }
    }
    
    public static void w(String message){
        if(DEBUG){
            Log.w(APP_TAG, message);
        }
    }
    
    public static void w(String tag, String message){
        if(DEBUG){
            Log.w(tag, message);
        }
    }
    
    public static void d(String message){
        if(DEBUG){
            Log.d(APP_TAG, message);
        }
    }
    
    public static void d(String tag, String message){
        if(DEBUG){
            Log.d(tag, message);
        }
    }
    
    public static void v(String message){
        if(DEBUG){
            Log.v(APP_TAG, message);
        }
    }
    
    public static void v(String tag, String message){
        if(DEBUG){
            Log.v(tag, message);
        }
    }
    
    private static final String SPACE = " ";
    static String buildMessage(Object[] messages) {
        StringBuilder builder = new StringBuilder();
        
        if (messages != null) {
            int len = messages.length;
            for (int i = 0; i < len; ++i) {
                builder.append(messages[i]);
                if (i < len - 1){
                    builder.append(SPACE);
                }
            }
        }
        
        return builder.toString();
    }
    
    public static void i(Object... messages) {
        if (DEBUG) {
            Log.i(APP_TAG, buildMessage(messages));
        }
    }
    
    public static void i(String tag, Object... messages) {
        if (DEBUG) {
            Log.i(tag, buildMessage(messages));
        }
    }
    
    public static void debug(Object... messages) {
        if (DEBUG) {
            Log.d(APP_TAG, buildMessage(messages));
        }
    }
    
    public static void debug(String tag, Object... messages) {
        if (DEBUG) {
            Log.d(tag, buildMessage(messages));
        }
    }
    
    public static void debugw(String tag, Object... messages) {
        if (DEBUG) {
            Log.w(tag, buildMessage(messages));
        }
    }
    
    public static void debuge(String tag, Object... messages) {
        if (DEBUG) {
            Log.e(tag, buildMessage(messages));
        }
    }
}
